#pragma once

#include"HashTable.h"
namespace HaSet
{
	template<class K,class Hash=HashFunc<K>>
	class HashSet
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
		typedef typename Open_hash::HashTable<K, K, Hash, SetKeyOfT>::iterator iterator;
	private:
		Open_hash::HashTable<K, K, Hash, SetKeyOfT> table;
	public:
		bool insert(const K& key)
		{
			return table.Insert(key).second;
		}
        iterator begin()
		{
			return table.begin();
		}
		iterator end()
		{
			return table.end();
		}
	};
	void TestSet1()
	{
		HashSet<int> t;
		int arr[] = { 1, 5, 8, 2, 9 };
		for (auto e : arr)
		{
			t.insert(e);
		}
		auto it = t.begin();
		while (it != t.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}
}